// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
window.addEventListener("DOMContentLoaded", () => {
  const replaceText = (selector: string, text: string) => {
    const element = document.getElementById(selector);
    if (element) {
      element.innerText = text;
    }
  };
  for (const type of ["chrome", "node", "electron"]) {
    replaceText(`${type}-version`, (process.versions as any)[type]);
  }
  const { contextBridge, ipcRenderer } = require("electron");  
  const client = require('ping-tcp-js')
  const fs = require('fs');
  contextBridge.exposeInMainWorld("fs", fs);
  contextBridge.exposeInMainWorld("client", client);
  contextBridge.exposeInMainWorld('electronAPI',{
    telnet: () => ipcRenderer.invoke('net:telnet')
  })
});